//
//  ViewController.m
//  核心动画
//
//  Created by chichaojituan521 on 2017/5/23.
//  Copyright © 2017年 linch. All rights reserved.
//

#import "AnimationVC1.h"
#import "AnimationVC2.h"

@interface AnimationVC1 ()

@end

@implementation AnimationVC1

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    
    
    NSArray *arrName = @[@"位置",@"坐标x",@"坐标y",@"翻转x",@"翻转y",@"翻转z",@"翻转",@"缩放",@"平移x",@"平移y",@"闪烁",@"组合",@"bounds",@"边框",@"圆角",@"换图",@"阴影色",@"阴影ofset",@"阴影圆角",@"阴影alpha",@"size",@"sizeHeight",@"sizeWidth",@"bgColor",@"返回"];
    
    _imgv1 = [[UIImageView alloc]initWithFrame:CGRectMake((self.view.frame.size.width-300)/2.0, 40, 300, 190)];
    
    [self.view addSubview:_imgv1];
    _imgv1.image = [UIImage imageNamed:@"1.jpg"];
    _imgv1.backgroundColor = [UIColor orangeColor];
        _imgv3 = [[UIImageView alloc]initWithFrame:CGRectMake(30, 400, 30, 30)];
    [self.view addSubview:_imgv3];
    _imgv3.image = [UIImage imageNamed:@"btnbtn"];
    
    _view2 = [[UIView alloc]initWithFrame:CGRectMake(200, 320, 100, 100)];
    [self.view addSubview:_view2];
    _view2.backgroundColor = [UIColor redColor];
    
    
    for (int i = 0;i<25 ; i++) {
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
        btn.titleLabel.font = [UIFont systemFontOfSize:13];
        btn.backgroundColor = [UIColor orangeColor];
        float JG = (self.view.frame.size.width - 70*5)/6.0;
        float btnx = JG + (JG + 70)*(i%5);
        float btny = 500 + (JG+30)*(i/5);
        btn.frame = CGRectMake(btnx, btny, 70, 30);
        [self.view addSubview:btn];
        btn.tag = i;
        [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
        [btn setTitle:arrName[i] forState:UIControlStateNormal];
    }
    
}
-(void)btnClick:(UIButton *)btn
{
    switch (btn.tag) {
        case 0:
            [self positionChangeMethod];
            break;
        case 1:
            [self positionxChangeMethod];
            break;
        case 2:
            [self positionyChangeMethod];
            break;
        case 3:
            [self rotationxChangeMethod];
            break;
        case 4:
            [self rotationyChangeMethod];
            break;
        case 5:
            [self rotationzChangeMethod];
            break;
        case 6:
            [self XuanZhuan];
            break;
        case 7:
            [self scaleChangeMethod];
            break;
        case 8:
            [self translationxChangeMethod];
            break;
        case 9:
            [self translationyChangeMethod];
            break;
        case 10:
            [self flashAnimationMethod];
            break;
        case 11:
            [self animationGroup];
            break;
        case 12:
            [self boundsMethod];
            break;
        case 13:
            [self borderWidthAni];
            break;
        case 14:
            [self cornerRadiusAni];
            break;
        case 15:
            [self contentsAni];
            break;
        case 16:
            [self shadowColorAni];
            break;
        case 17:
            [self shadowOffset];
            break;
        case 18:
            [self shadowRadius];
            break;
        case 19:
            [self shadowOpacity];
            break;
        case 20:
            [self sizeAnimationMethod];
            break;
        case 21:
            [self sizeheightAnimationMethod];
            break;
        case 22:
            [self sizewidthAnimationMethod];
            break;
        case 23:
            [self backgroundColorAnimation];
            
            break;
        case 24:
            [self popToLastVC];
            
            break;


        default:
            break;
    }
}
-(void)popToLastVC
{
    [self.navigationController popViewControllerAnimated:YES];
}

/*
 *********************************************
 *********************************************
 */


#pragma mark --中心平移(imgv2的中心点 移动到imgv1的中心点)
- (void)positionChangeMethod {
    CABasicAnimation * ani = [CABasicAnimation animationWithKeyPath:@"position"];
    ani.toValue = [NSValue valueWithCGPoint:self.imgv1.center];
    ani.removedOnCompletion = YES;    //完成后  返回原位置
    ani.fillMode = kCAFillModeForwards;
    ani.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
    ani.duration = 1;
    [self.imgv3.layer addAnimation:ani forKey:@"position"];
}
#pragma mark --中心平移x坐标
- (void)positionxChangeMethod {
    CABasicAnimation * ani = [CABasicAnimation animationWithKeyPath:@"position.x"];
    ani.toValue = @(self.imgv1.center.x) ;

    ani.removedOnCompletion = NO;
    ani.fillMode = kCAFillModeForwards;
    ani.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
    ani.duration = 1;
    [self.imgv3.layer addAnimation:ani forKey:@"positionx"];
}
#pragma mark --中心平移y坐标
- (void)positionyChangeMethod {
    CABasicAnimation * ani = [CABasicAnimation animationWithKeyPath:@"position.y"];
    ani.toValue = @(self.imgv1.center.y);
    ani.removedOnCompletion = YES;    //完成后  返回原位置
    ani.fillMode = kCAFillModeForwards;
    ani.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
    ani.duration = 1;
    [self.imgv3.layer addAnimation:ani forKey:@"positiony"];
}
#pragma mark --rotation翻转x
- (void)rotationxChangeMethod {
    CABasicAnimation * ani = [CABasicAnimation animationWithKeyPath:@"transform.rotation.x"];
    
    ani.fromValue = [NSNumber numberWithFloat:0.f];
    
    ani.toValue =  [NSNumber numberWithFloat: M_PI*2 ];
    ani.removedOnCompletion = YES;    //完成后  返回原位置
    ani.fillMode = kCAFillModeForwards;
    ani.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
    ani.duration = 3;
    [self.imgv1.layer addAnimation:ani forKey:@"rotationx"];
}
#pragma mark --rotation翻转y
- (void)rotationyChangeMethod {
    
    _imgv1.image = [UIImage imageNamed:@"1.jpg"];
    CABasicAnimation * ani = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];
    
    ani.fromValue = [NSNumber numberWithFloat:0.f];
    
    ani.toValue =  [NSNumber numberWithFloat: M_PI *2];
    ani.removedOnCompletion = NO;    //完成后  返回原位置
    ani.fillMode = kCAFillModeForwards;
    ani.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
    ani.duration = 3;
    _imgv1.image = [UIImage imageNamed:@"timg1.jpg"];
    [self.imgv1.layer addAnimation:ani forKey:@"rotationy"];
}
#pragma mark --rotation翻转z
- (void)rotationzChangeMethod {
    CABasicAnimation * ani = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
    
    ani.fromValue = [NSNumber numberWithFloat:0.f];
    
    ani.toValue =  [NSNumber numberWithFloat: M_PI];
//    ani.removedOnCompletion = YES;    //完成后  返回原位置
    ani.autoreverses = YES;        //用动画 形式返回原来状态
    ani.fillMode = kCAFillModeForwards;
    ani.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
    ani.duration = 3;
    [self.imgv3.layer addAnimation:ani forKey:@"rotationz"];
}
#pragma mark --rotation翻转
- (void)XuanZhuan{
    CABasicAnimation *transformAnima = [CABasicAnimation animationWithKeyPath:@"transform"];
    transformAnima.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
    //CATransform3DIdentity 是单位矩阵，该矩阵没有缩放、旋转、歪斜、透视。把该矩阵应用到图层上面会把图层几何属性修改为默认值
    //沿着Z轴旋转
    transformAnima.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI_2, 1, 1, 1)];
    //旋转效果累计（即下一次动画执行是否接着刚才的动画）
    transformAnima.cumulative = YES;
    //旋转2遍
    transformAnima.repeatCount = 2;
    transformAnima.duration = 3.0;
    [self.imgv1.layer addAnimation:transformAnima forKey:@"xyz"];
}
#pragma mark --scale缩放
- (void)scaleChangeMethod {
    CABasicAnimation * ani = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
    //默认是顺时针效果，若将fromValue和toValue的值互换，则为逆时针效果
    /*
     *与 key 有bug
     */
    ani.fromValue = [NSNumber numberWithFloat:1.f];
    ani.toValue =  [NSNumber numberWithFloat:2.f];
//    ani.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(1, 1, 1)];
//    ani.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(2,2,2)];


    ani.removedOnCompletion = YES;    //完成后  返回原位置
    ani.fillMode = kCAFillModeForwards;
    ani.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
    ani.duration = 3;
    [self.imgv3.layer addAnimation:ani forKey:@"scale"];
}

#pragma mark --translation平移x
- (void)translationxChangeMethod {
    CABasicAnimation * ani = [CABasicAnimation animationWithKeyPath:@"transform.translation.x"];
    //默认是顺时针效果，若将fromValue和toValue的值互换，则为逆时针效果
    ani.fromValue = [NSNumber numberWithFloat:0.f];
    ani.toValue =  [NSNumber numberWithFloat:200.f];
    
    ani.removedOnCompletion = YES;    //完成后  返回原位置
    ani.fillMode = kCAFillModeForwards;
    ani.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
    ani.duration = 3;
    [self.imgv3.layer addAnimation:ani forKey:@"translationx"];
}
#pragma mark --translation平移y
- (void)translationyChangeMethod {
    CABasicAnimation * ani = [CABasicAnimation animationWithKeyPath:@"transform.translation.y"];
    //默认是顺时针效果，若将fromValue和toValue的值互换，则为逆时针效果
    ani.fromValue = [NSNumber numberWithFloat:0.f];
    ani.toValue =  [NSNumber numberWithFloat:200.f];
    
    ani.removedOnCompletion = YES;    //完成后  返回原位置
    ani.fillMode = kCAFillModeForwards;
    ani.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
    ani.duration = 3;
    [self.imgv3.layer addAnimation:ani forKey:@"translationx"];
}
#pragma mark --opacity闪烁
-(void)flashAnimationMethod
{
    CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"opacity"];//必须写opacity才行。
    
    animation.fromValue = [NSNumber numberWithFloat:1.0f];
    
    animation.toValue = [NSNumber numberWithFloat:0.0f];//这是透明度。
    
    animation.autoreverses = YES;     //动画结束时是否执行逆动画.
    
    animation.duration = 1;
    
    animation.repeatCount = MAXFLOAT;  //无限重复
    
    animation.removedOnCompletion = NO;     //复原
    
    animation.fillMode = kCAFillModeForwards;
    
    animation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];///没有的话是均匀的动画。
    [self.imgv1.layer addAnimation:animation forKey:@"flash"];
}
#pragma mark --group 组合动画
-(void)animationGroup{
    CAAnimationGroup *animGroup = [CAAnimationGroup animation];
    //缩放
    CABasicAnimation *banScale = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
    banScale.fromValue = [NSNumber numberWithFloat:1.f];
    banScale.toValue = [NSNumber numberWithFloat:2.f];

    //透明
    CABasicAnimation *banOpacity = [CABasicAnimation animationWithKeyPath:@"opacity"];
    banOpacity.fromValue = [NSNumber numberWithFloat:1.0];
    banOpacity.toValue = [NSNumber numberWithFloat:0.1];

    //旋转
//    CABasicAnimation *transformAnim = [CABasicAnimation animationWithKeyPath:@"transform"];
//    transformAnim.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
//    transformAnim.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI, 0, 0, 1)];
//    transformAnim.cumulative = YES;
//    transformAnim.repeatCount = 1;
    

    
    
    //             缩放和旋转动画 冲突 不能组合在一起****************************************************************************************************************************************************************************************
    
    animGroup.animations = @[banScale,banOpacity];
    
    animGroup.duration = 2.0;
    animGroup.removedOnCompletion = NO;
    animGroup.fillMode = kCAFillModeForwards;
    
    [self.imgv3.layer addAnimation:animGroup forKey:@"groupAni"];
}
#pragma mark --bounds  大小
-(void)boundsMethod
{
    CABasicAnimation * ani = [CABasicAnimation animationWithKeyPath:@"bounds"];
    
    ani.fromValue = [NSValue valueWithCGRect:_imgv3.bounds];
    ani.toValue =  [NSValue valueWithCGRect:_imgv1.bounds];
    
    ani.removedOnCompletion = YES;    //完成后  返回原位置
    ani.fillMode = kCAFillModeForwards;
    ani.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
    ani.duration = 3;
    [self.imgv3.layer addAnimation:ani forKey:@"bounds"];
}
#pragma mark --borderWidth  边框
- (void)borderWidthAni {
    CABasicAnimation *ani = [CABasicAnimation animationWithKeyPath:@"borderWidth"];
    ani.toValue = @(3);
    CABasicAnimation *ani2 = [CABasicAnimation animationWithKeyPath:@"borderColor"];
    ani2.toValue = (id)[UIColor greenColor].CGColor;
    CABasicAnimation *ani3 = [CABasicAnimation animationWithKeyPath:@"cornerRadius"];
    ani3.toValue = @(50);
    
    CAAnimationGroup *group = [CAAnimationGroup animation];
    group.fillMode = kCAFillModeForwards;
    group.removedOnCompletion = NO;
    group.duration = 1.5;
    group.animations = @[ani, ani2, ani3];
    
    [self.view2.layer addAnimation:group forKey:@"borderWidthAni"];
}
#pragma mark --cornerRadius  圆角
- (void)cornerRadiusAni {
    
    UIButton *btn = [self.view viewWithTag:14];
    self.view2.clipsToBounds = YES;
    CABasicAnimation *ani = [CABasicAnimation animationWithKeyPath:@"cornerRadius"];
    ani.fromValue = [NSNumber numberWithFloat:0];
    ani.toValue = [NSNumber numberWithFloat:20];
    ani.duration = 1.5;
    ani.fillMode = kCAFillModeForwards;
    ani.removedOnCompletion = NO;
    ani.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];
    [self.imgv3.layer addAnimation:ani forKey:@"cornerRadiusAn"];
     [btn.layer addAnimation:ani forKey:@"cornerRadiusAni"];
    [_view2.layer addAnimation:ani forKey:@"cornerRadiusAnii"];
    
    
}
#pragma mark --contents   换图片
- (void)contentsAni {
    CABasicAnimation *ani = [CABasicAnimation animationWithKeyPath:@"contents"];
    ani.fillMode = kCAFillModeForwards;
    ani.duration = 1.2;
    ani.removedOnCompletion = YES;
    ani.fillMode = kCAFillModeForwards;
    ani.toValue = (id)[UIImage imageNamed:@"timg1.jpg"].CGImage;
    [self.imgv1.layer addAnimation:ani forKey:@"contentsAni"];
}

#pragma mark --shadowColor   阴影颜色
- (void)shadowColorAni {
    self.imgv1.layer.shadowOpacity = 1.0;
    CABasicAnimation *ani = [CABasicAnimation animationWithKeyPath:@"shadowColor"];
    ani.toValue = (id)[UIColor greenColor].CGColor;
    ani.removedOnCompletion = NO;
    ani.duration = 1.2;
    ani.fillMode = kCAFillModeForwards;
    [self.imgv1.layer addAnimation:ani forKey:@"shadowColorAni"];
    
}
#pragma mark --shadowOffset   阴影偏移
- (void)shadowOffset {
    self.imgv1.layer.shadowOpacity = 1.0;
    CABasicAnimation *ani2 = [CABasicAnimation animationWithKeyPath:@"shadowOffset"];
    ani2.fromValue = [NSValue valueWithCGSize:CGSizeMake(0, 0)];
    ani2.toValue = [NSValue valueWithCGSize:CGSizeMake(3, 3)];
    ani2.removedOnCompletion = NO;
    ani2.fillMode = kCAFillModeForwards;
    ani2.duration = 1.5;
    ani2.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    [self.imgv1.layer addAnimation:ani2 forKey:@"shadowOffsetAni"];
}
#pragma mark --shadowOffset   阴影圆角
- (void)shadowRadius {
    self.view2.layer.shadowOpacity = 1.0;
    self.view2.layer.shadowOffset = CGSizeMake(10, 10);
    CABasicAnimation *ani2 = [CABasicAnimation animationWithKeyPath:@"shadowRadius"];
    ani2.toValue = @(5);
    ani2.removedOnCompletion = NO;
    ani2.fillMode = kCAFillModeForwards;
    ani2.duration = 1.5;
    ani2.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    [self.view2.layer addAnimation:ani2 forKey:@"shadowRadiusAni"];
}
#pragma mark --shadowOpacity   阴影透明度
-(void)shadowOpacity {
    
    CABasicAnimation*anim = [CABasicAnimation animationWithKeyPath:@"shadowOpacity"];
    
    anim.duration= 1.f;
    
    anim.fromValue= [NSNumber numberWithFloat:0.1];
    
    anim.toValue= [NSNumber numberWithFloat:1];

    anim.timingFunction= [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    
    anim.autoreverses= YES;
    anim.fillMode = kCAFillModeForwards;
    anim.removedOnCompletion = YES;
    
    [self.view2.layer addAnimation:anim forKey:@"shadowOpacity"];
}
#pragma mark --backgroundColor  背景颜色
-(void)backgroundColorAnimation
{
    CABasicAnimation *ani = [CABasicAnimation animationWithKeyPath:@"backgroundColor"];
    ani.fromValue =(id)[[UIColor redColor] CGColor];
    
    ani.toValue = (id)[[UIColor greenColor] CGColor];
    ani.duration = 1.2;
    ani.removedOnCompletion = NO;
    ani.fillMode = kCAFillModeForwards;
    [self.view2.layer addAnimation:ani forKey:@"backgroundColor"];

}
#pragma mark --size  width动画
-(void)sizewidthAnimationMethod
{
    CABasicAnimation *ani = [CABasicAnimation animationWithKeyPath:@"bounds.size.width"];
    ani.fromValue =@300;
    ani.toValue = @150;
    ani.duration = 1.2;
    ani.removedOnCompletion = NO;
    ani.fillMode = kCAFillModeForwards;
    
    [self.imgv1.layer addAnimation:ani forKey:@"size1"];
    
}
#pragma mark --size  height动画
-(void)sizeheightAnimationMethod
{
    CABasicAnimation *ani = [CABasicAnimation animationWithKeyPath:@"bounds.size.height"];
    ani.fromValue =@190;
    ani.toValue = @95;
    ani.duration = 1.2;
    ani.removedOnCompletion = NO;
    ani.fillMode = kCAFillModeForwards;
    
    [self.imgv1.layer addAnimation:ani forKey:@"size2"];
    
    
    
}
#pragma mark --size  size动画
-(void)sizeAnimationMethod
{
    CABasicAnimation *ani = [CABasicAnimation animationWithKeyPath:@"bounds.size"];
   
    ani.fromValue =[NSValue valueWithCGSize:CGSizeMake(300, 190)];
    ani.toValue = [NSValue valueWithCGSize:CGSizeMake(30, 19)];
    ani.duration = 1.2;
    ani.removedOnCompletion = NO;
    ani.fillMode = kCAFillModeForwards;
    
    [self.imgv1.layer addAnimation:ani forKey:@"size3"];
    
    
    
}


@end






/*
 
 
 
 
 
 
 - (void)theParameterInfo {
 //1.动画开始标记
 
 *  第一个参数:动画标识
 第二个参数: 附加参数, 在设置了代理的情况下, 此参数将发送到setAnimationWillStartSelector和setAnimationDidStopSelector所指定的方法. 大部分情况下, 我们设置为nil即可
 
[UIView beginAnimations:@"Animation" context:nil];
//2.结束动画标记
[UIView commitAnimations];


 *动画参数的设置方法
 
//1.动画持续时间
[UIView setAnimationDuration:2];
//2.动画的代理对象
[UIView setAnimationDelegate:self];
//3.设置动画将开始时代理对象执行的SEL
[UIView setAnimationWillStartSelector:@selector(handleAnimationStart:)];
//4.设置动画结束时代理对象执行的SEL
[UIView setAnimationDidStopSelector:@selector(handleAnimationStop)];
//5.设置动画延迟执行的时间
[UIView setAnimationDelay:1];
//6.设置动画的重读次数
[UIView setAnimationRepeatCount:2];
//.设置动画的曲线

 *  UIViewAnimationCurveEaseInOut --- 慢进慢出(默认)
 UIViewAnimationCurveEaseIn --- 慢进
 UIViewAnimationEaseOut --- 慢出
 UIViewAnimationCurveLinear --- 匀速
 
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
//7.设置是否从当前状态开始播放动画
[UIView setAnimationBeginsFromCurrentState:YES];

 *  假设上一个动画正在播放, 且尚未播放完毕, 我们将要进行一个新的动画:
 当为YES时: 动画将从上一个动画所在的状态开始播放
 当为NO时 : 动画将从上一个动画所指定的最终状态开始播放(此时上一个动画马上结束)
 
//8.设置动画是否继续执行相反的动画
[UIView setAnimationRepeatAutoreverses:YES];
//9.是否禁用动画效果(对象属性依然会被改变, 只是没有动画效果)
[UIView setAnimationsEnabled:NO];
//10.设置视图的过渡效果
**
 *  第一个参数: UIViewAnimationTransition的枚举值如下:
 UIViewAnimationTransitionNone --- 不使用动画
 UIViewAnimationTransitionFilpFromLeft --- 从左向右旋转翻页
 UIViewAnimationTransitionFilpFromRight --- 从右向左选装翻页
 UIViewAnimationTransitionCurUp --- 从下往上卷曲翻页
 UIViewAnimationTransitionCurDowm --- 从上往下卷曲翻页
 第二个参数: 需要过渡效果的View
 第三个参数: 是否使用视图缓存, YES:视图在开始和结束时渲染一次; NO:视图在每一帧都渲染
 
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
**
 *  UIViewAnimationOptions的枚举值如下, 可组合使用:
 UIViewAnimationOptionLayoutSubViews -- 进行动画时布局子控件
 UIViewAnimationOptionAllowUserInteraction -- 进行动画时允许用户交互
 UIViewAnimationOptionBeginFromCurrentState -- 从当前状态开始动画
 UIViewAnimationOptionRepeat -- 无限重复执行动画
 UIViewAnimationOptionAutoreverse -- 执行动画回路
 UIViewAnimationOptionOverrideInheritedDuration -- 忽略嵌套动画的执行时间的设置
 UIViewAnimationOptionOverrideInheritedCurve -- 忽略嵌套动画的曲线设置
 UIViewAnimationOptionAllowAnimatedContent -- 转场: 进行动画时重绘视图
 UIViewAnimationOverrideInheritedOptions -- 不继承父动画设置
 
 UIViewAnimationOptionCurveEaseInOut -- 时间曲线, 慢进慢出(默认值)
 UIViewAnimationOptionCurveEaseIn -- 时间曲线, 慢进
 UIViewAnimationOptionCurveEaseOut -- 时间曲线, 慢出
 UIViewAnimationOptionCurveLinear -- 时间曲线, 匀速
 
 UIViewAnimationOptionTransitionNone -- 转场, 不使用动画
 UIViewAnimationOptionTransitionFlipFromLeft -- 转场, 从左向右旋转翻页
 UIViewAnimationOptionTransitionFilpFromRigth -- 转场, 从右向左旋转翻页
 UIViewAnimationOptionTransitionCurUp -- 转场, 下往上卷曲翻页
 UIViewAnimationOptionTransitionCurDown -- 转场, 上往下卷曲翻页
 UIViewAnimationOptionTransitionCrossDissolve -- 转场, 交叉消失和出现
 UIViewAnimationOptionTransitionFilpFromTop -- 转场, 从上向下旋转翻页
 UIViewAnimationOptionTransitionFilpFromBottom -- 转场, 从下向上旋转翻页.
 *

}


**
 *  修改frame
 *
- (void)changeFrame {
    [UIView beginAnimations:@"FrameAni" context:nil];
    [UIView setAnimationDuration:1.0];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationWillStartSelector:@selector(startAni:)];
    [UIView setAnimationDidStopSelector:@selector(stopAni:)];
    [UIView setAnimationRepeatCount:1];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    self.imgv3.frame = self.imgv1.frame;
    [UIView commitAnimations];
}
**
 *  转场效果动画(以Filp效果为例)
 *
- (void)filpAni {
    [UIView beginAnimations:@"FlipAni" context:nil];
    [UIView setAnimationDuration:1.0];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationWillStartSelector:@selector(startAni:)];
    [UIView setAnimationDidStopSelector:@selector(stopAni:)];
    [UIView setAnimationRepeatCount:1];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];
    
    self.centerShow.image = [UIImage imageNamed:@"per0.jpg"];
    [UIView commitAnimations];
}
- (void)startAni:(NSString *)aniId {
    NSLog(@"%@ start", aniId);
}
- (void)stopAni:(NSString *)aniID {
    NSLog(@"%@ stop", aniID);
}

 */
